<template>
  <s-table
    bordered
    ref="table"
    :row-key="(record) => record.contract_id"
    :columns="contractColumns"
    :data="contractData"
    :scroll="{ y: 380 }"
  >
    <template slot="action" slot-scope="text, record">
      <a-button type="link" @click="$router.push({ name: 'ContractDetail', params: { id: record.contract_id } })">查看</a-button>
    </template>
  </s-table>
</template>

<script>
import { STable } from '@/components'
import { getCustomerContract } from '@/api/customer'
import col from '@/columns/customer'
const contractColumns = col.contract
export default {
  components: {
    STable
  },
  props: {
    keys: {
      type: String,
      default: ''
    }
  },
  name: 'ContractInfo',
  data () {
    return {
      contractColumns,
      contractLoading: true,
      queryParam: {},
      contractData: parameters => {
        return getCustomerContract(Object.assign(parameters, this.queryParam)).then(res => {
          return res.result
        })
      }
    }
  },
  created () {
    this.queryParam['filter[customer_id]'] = this.keys
  },
  methods: {}
}
</script>

<style scoped>

</style>
